How to turn set items into indexes for an array

join shbcf.ru